<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
            canvas{
                border:1px solid black;
            }
        </style>
</head>
<body>
        <canvas width=600 height=400 id="cas"></canvas>
        <script>
              var cas = document.getElementById("cas");
              var ctx = cas.getContext("2d")
              ctx.rect(100,20,100,100)
              ctx.fillStyle="red";
              ctx.stroke();
              ctx.fill();
              ctx.clearRect(110,30,20,40);

              ctx.beginPath();
              ctx.rect(200,200,100,100);
              ctx.strokeStyle="green";
              ctx.stroke();
           


              ctx.beginPath();
              ctx.strokeStyle="green";
              ctx.fillStyle="pink";
              ctx.fillRect(300,100,100,100)
            //   ctx.stroke();
            ctx.clearRect(320,150,20,40);
            
        </script>
</body>
</html>